package com.ChenYaRou.www.controller.servlet;

import com.ChenYaRou.www.controller.CreatShopServletController;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @ClassName CheckShopNameServlet
 * @Description TODO
 * @Author 86183
 * @Date 2022/5/8 10:10
 * @Version 1.0
 **/
public class CheckShopNameServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        PrintWriter out = resp.getWriter();
        String shopName = req.getParameter("shopName");
        shopName = shopName.substring(1, shopName.length() - 1);
        out.write(new CreatShopServletController().theSameShopName(shopName));
        out.flush();
        out.close();
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
